using System.Collections.Generic;
using System.IO;
using UnityEngine;

public class FileTreeSO : ScriptableObject
{
    [Header("文件汇总")] public List<FileTree> m_FileTrees;

    [ContextMenu("嘤嘤嘤--生成对应文件夹")]
    public void EditInit()
    {
        for (int i = 0; i < m_FileTrees.Count; i++)
        {
            for (int j = 0; j < m_FileTrees[i].m_Files.Count; j++)
            {
                m_FileTrees[i].m_Files[j].ImgFolder = $"Files/{m_FileTrees[i].Name}/{m_FileTrees[i].m_Files[j].Name}/Normal";
                m_FileTrees[i].m_Files[j].VideoFolder = $"Files/{m_FileTrees[i].Name}/{m_FileTrees[i].m_Files[j].Name}/Video";
                if (!Directory.Exists(Application.streamingAssetsPath + $"/{m_FileTrees[i].m_Files[j].ImgFolder}"))
                {
                    Directory.CreateDirectory(Application.streamingAssetsPath + $"/{m_FileTrees[i].m_Files[j].ImgFolder}");
                }

                if (!Directory.Exists(Application.streamingAssetsPath + $"/{m_FileTrees[i].m_Files[j].VideoFolder}"))
                {
                    Directory.CreateDirectory(Application.streamingAssetsPath + $"/{m_FileTrees[i].m_Files[j].VideoFolder}");
                }
            }
        }
    }
}